﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace POS
{
    /// <summary>
    /// Interaction logic for HotDrinks.xaml
    /// </summary>
    public partial class HotDrinks : Window
    {
        double blackCoffeePrice = 1.00;
        double cappuccinoPrice = 1.50;
        double hotButteredRumPrice = 2.00;
        double hotChocolatePrice = 2.00;
        double mochaCoffeePrice = 2.50;
        double teaPrice = 2.00;

        public HotDrinks()
        {
            InitializeComponent();
        }

        private void ButtonBackToMainMenu(object sender, RoutedEventArgs e)
        {
            MainWindow mainMenuWindow = new MainWindow();
            mainMenuWindow.Show();
            this.Close();
        }

        private void GoToOrdered(object sender, RoutedEventArgs e)
        {
            Ordered orderedMenu = new Ordered();
            orderedMenu.Show();
            this.Close();
        }

        private void ButtonBlackCoffee(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxBlackCoffeeCount.Text != "0") && (this.TextBoxBlackCoffeeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxBlackCoffeeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Black Coffee", blackCoffeePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonCappuccino(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxCappuccinoCount.Text != "0") && (this.TextBoxCappuccinoCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCappuccinoCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Cappuccino", cappuccinoPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonHotButteredRum(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxHotButteredRumCount.Text != "0") && (this.TextBoxHotButteredRumCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxHotButteredRumCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Hot Buttered Rum", hotButteredRumPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonHotChocolate(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxHotChocolateCount.Text != "0") && (this.TextBoxHotChocolateCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxHotChocolateCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Hot Chocolate", hotChocolatePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonMochaCoffee(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxMochaCoffeeCount.Text != "0") && (this.TextBoxMochaCoffeeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxMochaCoffeeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Mocha Coffee", mochaCoffeePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonTea(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxTeaCount.Text != "0") && (this.TextBoxTeaCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxTeaCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Tea", teaPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void RemoveCountBlackCoffeeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxBlackCoffeeCount.Text == String.Empty)
            {
                this.TextBoxBlackCoffeeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxBlackCoffeeCount.Text) > 0)
            {
                this.TextBoxBlackCoffeeCount.Text = (int.Parse(this.TextBoxBlackCoffeeCount.Text) - 1).ToString();
            }
        }

        private void AddCountBlackCoffeeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxBlackCoffeeCount.Text == String.Empty)
            {
                this.TextBoxBlackCoffeeCount.Text = "0";
            }
            this.TextBoxBlackCoffeeCount.Text = (int.Parse(this.TextBoxBlackCoffeeCount.Text) + 1).ToString();
        }

        private void RemoveCountCappuccinoButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCappuccinoCount.Text == String.Empty)
            {
                this.TextBoxCappuccinoCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCappuccinoCount.Text) > 0)
            {
                this.TextBoxCappuccinoCount.Text = (int.Parse(this.TextBoxCappuccinoCount.Text) - 1).ToString();
            }
        }

        private void AddCountCappuccinoButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCappuccinoCount.Text == String.Empty)
            {
                this.TextBoxCappuccinoCount.Text = "0";
            }
            this.TextBoxCappuccinoCount.Text = (int.Parse(this.TextBoxCappuccinoCount.Text) + 1).ToString();
        }

        private void RemoveCountHotButteredRumButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxHotButteredRumCount.Text == String.Empty)
            {
                this.TextBoxHotButteredRumCount.Text = "0";
            }

            if (int.Parse(this.TextBoxHotButteredRumCount.Text) > 0)
            {
                this.TextBoxHotButteredRumCount.Text = (int.Parse(this.TextBoxHotButteredRumCount.Text) - 1).ToString();
            }
        }

        private void AddCountHotButteredRumButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxHotButteredRumCount.Text == String.Empty)
            {
                this.TextBoxHotButteredRumCount.Text = "0";
            }
            this.TextBoxHotButteredRumCount.Text = (int.Parse(this.TextBoxHotButteredRumCount.Text) + 1).ToString();
        }

        private void RemoveCountHotChocolateButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxHotChocolateCount.Text == String.Empty)
            {
                this.TextBoxHotChocolateCount.Text = "0";
            }

            if (int.Parse(this.TextBoxHotChocolateCount.Text) > 0)
            {
                this.TextBoxHotChocolateCount.Text = (int.Parse(this.TextBoxHotChocolateCount.Text) - 1).ToString();
            }
        }

        private void AddCountHotChocolateButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxHotChocolateCount.Text == String.Empty)
            {
                this.TextBoxHotChocolateCount.Text = "0";
            }
            this.TextBoxHotChocolateCount.Text = (int.Parse(this.TextBoxHotChocolateCount.Text) + 1).ToString();
        }

        private void RemoveCountMochaCoffeeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxMochaCoffeeCount.Text == String.Empty)
            {
                this.TextBoxMochaCoffeeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxMochaCoffeeCount.Text) > 0)
            {
                this.TextBoxMochaCoffeeCount.Text = (int.Parse(this.TextBoxMochaCoffeeCount.Text) - 1).ToString();
            }
        }

        private void AddCountMochaCoffeeButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxMochaCoffeeCount.Text == String.Empty)
            {
                this.TextBoxMochaCoffeeCount.Text = "0";
            }
            this.TextBoxMochaCoffeeCount.Text = (int.Parse(this.TextBoxMochaCoffeeCount.Text) + 1).ToString();
        }

        private void RemoveCountTeaButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxTeaCount.Text == String.Empty)
            {
                this.TextBoxTeaCount.Text = "0";
            }

            if (int.Parse(this.TextBoxTeaCount.Text) > 0)
            {
                this.TextBoxTeaCount.Text = (int.Parse(this.TextBoxTeaCount.Text) - 1).ToString();
            }
        }

        private void AddCountTeaButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxTeaCount.Text == String.Empty)
            {
                this.TextBoxTeaCount.Text = "0";
            }
            this.TextBoxTeaCount.Text = (int.Parse(this.TextBoxTeaCount.Text) + 1).ToString();
        }
    }
}
